﻿@model PagedList.StaticPagedList<NewRen.Models.ViewModel.vExchangeCode>
@using NewRen.Models.ViewModel
@using NewRen.Models
@using PagedList
@using PagedList.Mvc
@{
    Business business = ViewBag.Business as Business;
    ViewBag.Title = "兑换管理";
    Layout = "~/Views/Shared/_Layout_Business.cshtml";
}
<div class="ucenter-left account-left-border">
    <div class="ucneter-l-head cf">
        <div class="ulhead-headicon">
            @if (business.Picture == null)
            {
                <img src="/Images/userphoto.png" width="50" height="50"
                     alt=@business.BusinessName style="border-radius:50%;" />
            }
            else
            {
                <img src="/Business/ShowPicture/@business.ID" width="50"
                     alt=@business.BusinessName height="50" style="border-radius:50%;" />
            }

        </div>
        <div class="ulhead-info">
            <p class="ulhead-info-uname">@business.BusinessName</p>

            <div class="ulhead-info-tool">
                <a class="ulhead-icon icon-lock ucenter-mail " href="/Business/PwdEdit/@business.ID" title="修改密码">
                    <div class="ucenter-mail-tip">修改密码</div>
                </a>
                <a href="/Business/Edit/@business.ID"
                   class="ulhead-icon icon-setting ucenter-mail" title="设置商户信息"></a>
            </div>
        </div>
    </div>
    <div class="ucenter-l-list">
        <ul class="ullist-ul">
            <li id="uclick">
                <a href="/Business/Show/@business.ID">商户中心</a>
            </li>
            <li id="uclick1">
                <a href="/Business/Edit/@business.ID">商户设置</a>
            </li>
            <li id="uclick2">
                <a href="/Business/ProductManager/@business.ID">商户商品</a>
            </li>
            <li id="uclick3"  class="active">
                <a href="/Business/ExchangeManager/@business.ID">兑换管理</a>
            </li>
        </ul>
    </div>
</div>
<div class="ucenter-right cf">
    <div class="ucenter-right-head"><h3>兑换管理</h3></div>
    <div class="ucenter-right-body">
        <form method="get">
            <input type="text" name="Begin" class="textbox date nullable" placeholder="发布时间(大于)" value="@Request.QueryString["Begin"]" onclick="date()" />
            <input type="text" name="End" class="textbox date nullable" placeholder="发布时间(小于)" value="@Request.QueryString["End"]" onclick="date()" />
            <select class="textbox" name="IsExchange">
                <option value="">是否兑换</option>
                <option value="">请选择</option>
                <option value="true">是</option>
                <option value="false">否</option>
            </select>
            <input type="submit" class="btn btn-info" value="检索" />
        </form>
        <table class="inte_tbird">
            <tr class="inte_pt">
                <td class="inte_ird0">用户名</td>
                <td class="inte_ird">产品名</td>
                <td class="inte_ird">兑换号</td>
                <td class="inte_ird">下单时间</td>
                <td class="inte_ird">是否兑换</td>
                <td class="inte_ird">兑换时间</td>
                <td class="inte_ird0">操作</td>
            </tr>
            @foreach (var item in Model)
            {
                <tr class="inte_pt" id="@item.ID">
                    <td class="inte_ird0"><a href="/User/PersonalShow/@item.UserID">@item.UserName</a></td>
                    <td class="inte_ird"><a href="/Product/Show/@item.ProductID">@item.ProductName</a></td>
                    <td class="inte_ird">@item.Code</td>
                    <td class="inte_ird">@item.Time</td>
                    <td class="inte_ird">@(item.IsExchange ? "是" : "否")</td>
                    <td class="inte_ird">@item.ChangeTime</td>
                    <td class="inte_ird0">
                        @if (item.IsExchange)
                        {
                            <span>无</span>
                        }
                        else
                        {
                            <a href="javascript:changeDialog(@item.ID,'@ViewBag.SID')" style="cursor: pointer;">确认兑换</a>
                        }
                    </td>
                </tr>
            }
        </table>
        <div class="left-2">@Html.PagedListPager((IPagedList)Model, page => Url.Action("ExchangeManager", new { id = business.ID, page = page, Begin = Request.QueryString["Begin"], End = Request.QueryString["End"], IsExchange = Request.QueryString["IsExchange"] }))</div>
    </div>
</div>